from datetime import datetime
from django.template import Context, loader
from django.http import HttpResponse
from monulu.raid.models import Raid

def index(request):
    future_raids = Raid.objects.filter(start_time__gte= datetime.now()).order_by('-start_time')
    past_raids = Raid.objects.filter(start_time__lte= datetime.now()).order_by('-start_time')[:5]
    t = loader.get_template('raid/index.html')
    c = Context({'future': future_raids,'past': past_raids})
    return HttpResponse(t.render(c))

def detail(request, raid_id):
    return HttpResponse("You're looking at the raid %s." % raid_id)

def latest(request):
    return HttpResponse("The latest")